package com.example.demo.typeEnums;

import java.util.Calendar;

/**
 * 保留的类型
 * {@link Calendar}
 */
public enum ReservedType {
    /**
     * 数量
     */
    QUANTITY("QUANTITY",-1),
    /**
     * 天
     */
    DAY("DAY",24*60*60),
    /**
     * 小时
     */
    HOUR("HOUR",60*60),

    ;

    private String name;
    private Integer value;

    ReservedType(String name,Integer value) {
        this.name = name;
        this.value = value;
    }

    public String getName(){
        return name;
    }
    public Integer getValue() {
        return value;
    }

    public static ReservedType getReservedType(String name, Integer value){
        for(ReservedType executeType : ReservedType.values()){
            if(executeType.name.equals(name) || executeType.value.equals(value)){
                return executeType;
            }
        }
        return QUANTITY;
    }
}
